package com.information.manage.basic.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.information.manage.basic.model.entity.SysUserDO;
import com.information.manage.basic.model.query.*;
import com.information.manage.basic.model.vo.FindUserVO;
import com.information.manage.basic.model.vo.LoginUserInfoVO;
import com.information.manage.basic.model.vo.SysUserPageVO;
import com.information.manage.basic.model.vo.UserMenuVO;
import com.information.manage.basic.common.result.Result;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author sy
 * @since 2021-12-22
 */
public interface SysUserService extends IService<SysUserDO> {

    /**
     * 用户登录
     * @param loginQuery
     * @return
     */
    Result login(LoginQuery loginQuery);

    /**
     * 获取用户信息
     * @param userId
     * @return
     */
    LoginUserInfoVO getUserInfo(Integer userId);

    /**
     * 退出登录
     * @param userId
     */
    void loginOut(Integer userId);

    /**
     * 新增用户
     * @param sysUserAddQuery
     * @return
     */
    Result<Integer> addUser(SysUserAddQuery sysUserAddQuery);

    /**
     * 保存用户菜单
     * @param userIds
     * @param menuIds
     * @return
     */
    boolean saveUserMenu(List<Integer> userIds, List<Integer> menuIds);

    /**
     * 修改用户
     * @param sysUserUpdateQuery
     * @return
     */
    Result<Integer> updateUser(SysUserUpdateQuery sysUserUpdateQuery);

    /**
     * 用户绑定员工
     * @param staffId
     * @return
     */
    Result<Boolean> userBindStaff(Integer staffId, Integer userId);

    /**
     * 删除用户
     * @param userIds
     * @return
     */
    Boolean deleteUser(List<Integer> userIds);

    /**
     * 移动用户菜单
     * @param userId 用户id
     * @param menuId 菜单id
     * @param up 是否上移 true上移 false下移
     * @return
     */
    Boolean moveUserMenu(Integer userId, Integer menuId, boolean up);

    /**
     * 查询用户分页
     * @param sysUserPageQuery
     * @return
     */
    Result<Page<SysUserPageVO>> queryUserPage(SysUserPageQuery sysUserPageQuery);

    /**
     * 获取用户的菜单权限
     * @param userMenuQuery
     * @return
     */
    Result<List<UserMenuVO>> getUserMenu(HttpServletRequest request, UserMenuQuery userMenuQuery);

    FindUserVO findUserById(Integer userId);
}
